<template>
	<view>
		<my-header :title="title" :back="true"></my-header>
		
		<view v-if="!hisList.length" class="noHis">暂无历史诉求</view>
		<view  v-else style="margin-top: 60px;">
		<uni-card  v-for="item in hisList" class='cardList' @click="showMore(item.demandId)">
			<!-- <uni-section :title="item.enterpriseName" type="line" titleFontSize="16px"/> -->
			<uni-row style="padding: 20rpx 0; display: flex; flex-direction: column; justify-content: center;">
				<uni-steps :options="list1" :active="item.statusId - 1" />
				<!-- <uni-icons type="down" size="20" color="#D3D3D3" @tap="showMore"></uni-icons> -->
			</uni-row>
			<uni-row>
				<uni-steps :options="demandLogList" active-color="#007AFF"  direction="column" />
			</uni-row>
			<uni-row >
				<uni-col :span='8'>企业名称:</uni-col>
				<uni-col :span="16">{{item.enterpriseName}}</uni-col>
			</uni-row>
		<!-- 	<uni-row>
				<uni-col :span='8'>诉求类型:</uni-col>
				<uni-col :span="16">{{item.demandTypeName}}</uni-col>
			</uni-row> -->
			<!-- <uni-row>
				<uni-col :span='8'>诉求标题:</uni-col>
				<uni-col :span="16">{{item.demandTitle}}</uni-col>
			</uni-row> -->
			<uni-row>
				<uni-col :span='8'>诉求内容:</uni-col>
				<uni-col :span="16">{{item.demandContent}}</uni-col>
			</uni-row>
			
		</uni-card>
		</view>
	</view>
</template>

<script>
	import MyHeader from '@/components/header.vue'
	export default {
		components: {
			MyHeader,
		},
		data() {
			return {
				title: '历史诉求',
				hisList: [
					// {
					// 	enterpriseName: '企业名称',
					// 	demandTypeName: '诉求类型',
					// 	demandTitle: '诉求标题',
					// 	demandContent: '诉求内容诉求内容诉求内容诉求内容诉求内容',
					// 	submitter: '提交人',
					// 	demandReply: '回复回复回复回复回复',
					// 	statusId: 3,
					// 	fileLists: [
					// 		{
					// 			cloudPath: "1715823756287_0.png",
					// 			extname: "png",
					// 			fileID: "https://mp-0fc770c0-3b77-4d0b-a5d4-aad1015fc59d.cdn.bspapp.com/cloudstorage/39d2e1b7-f5e5-4b69-bc3b-6ff0a0a39a7e.png",
					// 			fileType: "image",
					// 			name: "我要入驻.png",
					// 			path: "https://mp-0fc770c0-3b77-4d0b-a5d4-aad1015fc59d.cdn.bspapp.com/cloudstorage/39d2e1b7-f5e5-4b69-bc3b-6ff0a0a39a7e.png",
					// 			size: 4688,
					// 			url: "https://mp-0fc770c0-3b77-4d0b-a5d4-aad1015fc59d.cdn.bspapp.com/cloudstorage/39d2e1b7-f5e5-4b69-bc3b-6ff0a0a39a7e.png",
					// 			uuid: 1715823756288,
					// 		}
					// 	]
					// }
				],
				customFormData: {
					contact: ''
				},
				list1: [{
					title: '待流转'
				}, {
					title: '办理中'
				}, {
					title: '已完成'
				}],
				imageStyles: {
					width: 64,
					height: 64,
					// border: {
					// 	radius: '50%'
					// }
				},
				demandLogList: [],
				
			}
		},
		onLoad: function (option) { //option为object类型，会序列化上个页面传递的参数
			console.log(option); //打印出上个页面传递的参数。
			this.hisList = JSON.parse(option.detail)
			console.log(this.hisList);
			// this.customFormData.contact = option.phone
			// this.customFormData.code = option.code
			// this.dialogInputConfirm()
			//获取本地保存账号信息 修改登录状态
			let that = this
			uni.getStorage({
				key: 'shuangfengData',
				success: function (res) {
					that.shuangfengData = res.data
					console.log(res.data, that.shuangfengData);
				}
			});
		},
		methods: {
			backIndex() {
				uni.navigateBack({
					delta: 1
				});
			},
			// 查看历史申诉
			dialogInputConfirm() {
				console.log(this.customFormData, 'customFormData')
				uni.request({
					url: '/sf_enterprise_service/business/demand/selflist/',
					data: this.customFormData,
					method: 'GET',
					header: {
						'Token': this.shuangfengData.token
					},
					success: (res) => {		
						console.log(res, 'res??')
						if(res.data.data?.length) {	
							this.hisList = res.data.data
							console.log(this.hisList)
						} else {
							uni.showToast({
								title: res.data.msg,
								icon: 'none',
								duration: 2000
							})
						}
					},
					complete: () => {							
						uni.hideLoading();
					}
				})
			},
			showMore(demandId) {
				uni.navigateTo({
					url: '/pages/form/detail?id=' + demandId,
				})
				// uni.request({
				// 	url: '/sf_enterprise_service/business/anondemand/info/' + demandId,
				// 	// data: this.customFormData,
				// 	method: 'GET',
				// 	success: (res) => {		
				// 		console.log(res, 'res?detail')
				// 		this.demandLogList = res.data.data.demandLogList
				// 	},
				// 	complete: () => {							
				// 		uni.hideLoading();
				// 	}
				// })
				// console.log(demandId, 'moremore')
			}
		}
	}
</script>

<style>
.noHis {
	text-align: center;
	margin-top: 80px;
}
.uni-icons{
	z-index: 3;
	position: fixed;
	top: 15px;
	left: 15px;
}
</style>
